import {
	MENU_COLLAPSE_ACTION,
	SET_MENU_COLLAPSE,
	GET_MENU_COLLAPSE,
	STORAGE_MENU_COLLAPSE
} from '@/utils/Const';
import Storage from '@/utils/Storage';

export default {
	namespaced : true,
	state : {
		value : Storage.get(STORAGE_MENU_COLLAPSE, 1) || false
	},
	getters : {
		[GET_MENU_COLLAPSE] (state) {
			return state.value;
		}
	},
	mutations : {
		[SET_MENU_COLLAPSE] (state, payload) {
			state.value = payload;
			Storage.set(STORAGE_MENU_COLLAPSE, payload, 1);
		}
	},
	actions : {
		[MENU_COLLAPSE_ACTION] ({ commit }, payload) {
			commit(SET_MENU_COLLAPSE, payload);
		}
	}
};
